<div id="register" class="animate form login_form">
	<section class="login_content">
		<form>
			<h1>Create Account</h1>
			<div>
				<input type="text" v-model="user.userName" class="form-control" placeholder="Username" required="" @focus="" />
				<span>{{registerMsg}}</span>
			</div>
			<div>
				<input type="password" v-model="user.passWord" class="form-control" placeholder="Password" required="" />
			</div>
			<div>
				<a class="btn btn-default submit" href="javascript:void(0);" @click="register()">Submit</a>
			</div>

			<div class="clearfix"></div>

			<div class="separator">
				<p class="change_link">
					Already a member ?
					<a href="/account/login" class="to_register"> Log in </a>
				</p>

				<div class="clearfix"></div>
				<br />

				<div>
					<h1><i class="fa fa-paw"></i> TL!</h1>
					<p>©Freaking Awesome!</p>
				</div>
			</div>
		</form>
	</section>
</div>

<script>
	var register = new Vue({
		el:"#register",
		data:{
			user:{
				userName:"",
				passWord:""
			},
		flag:false,
		registerMsg:"",
		},
		methods: {
			register: function () {
				if(this.user.userName == "" || this.passWord == ""){
					layer.msg("请输入用户名和密码。",{icon : 0});
				}

				var _this = this;
				axios({
					url:"/user/register",
					method:"post",
					data:_this.user
				}).then(function (resp) {
					if (resp.data.status == 200){
						window.location.href= "/account/login"
					}
					if (resp.data.status == 500){
						layer.msg(resp.data.msg,{icon: 0})
					}
				})
			},
			/*checkName:function () {
				var _this = this;
				axios({
					url: "user/register",
					type: "post",
					data:{
						user:_this.user,
						flag:true
					}
				})
			}*/
		},
	})
</script>